<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var fn = function(){}
        // let fn = () =>{

        // }
        const SCHOOL = {
            name:"渣男"
        }
        window.name = "123";
        console.log(this);
        function getName (){
            console.log(this.name)
        }
        getName()
        let getName2 =()=>{
            console.log(this.name)
        }
        getName2()
        getName.call(SCHOOL)
        getName2.call(SCHOOL)
        /*
            箭头函数开始的时候作用域的this指向某一个位置对象后就不会改变当前的this
            箭头函数不能作为构造函数实例化对象
            箭头函数参数只有一个的话可以省略 入参左右的（）
            箭头函数参数里面只有一句话可以省略大括号（如果一句话含有return 那么return也省略）
        */ 
        // let Person =(name , age)=>{
        //     this.name = name;
        //     this.age = age ;
        // }
        // let zhanan = new Person("王思聪","999999");
        // console.log(zhanan)
        let fn =q=>q+q;
        console.log(fn(3))
    </script>


    <script>
     
     
        const SCHOOL = {
            name:"渣男"
        }
        window.name = "123";
        console.log(this);
        function getName (){
            console.log(this.name)
        }
        getName()
        let getName2 =()=>{
            console.log(this.name)
        }
        getName2()
        getName.call(SCHOOL)
        getName2.call(SCHOOL)
        let fn =q=>q+q;
        console.log(fn(3))
    </script>





    <script>
        const SCHOOL = {
            name:"渣男"
        }
        window.name = "123";
        console.log(this);
        function getName (){
            console.log(this.name)
        }
        getName()
        let getName2 =()=>{
            console.log(this.name)
        }
        getName2()
        getName.call(SCHOOL)
        getName2.call(SCHOOL)
        let fn =q=>q+q;
        console.log(fn(3))
    </script>
</body>
</html>